/*
 * 
 * 
 * 
 */
package com.hboxs.asl.service;

import com.hboxs.asl.Page;
import com.hboxs.asl.Pageable;
import com.hboxs.asl.entity.Member;
import com.hboxs.asl.entity.Trade;

import java.math.BigDecimal;

/**
 * Service - 充值
 */
public interface TradeService extends BaseService<Trade, Long> {

    Trade findByTn(String tn);

    /**
     * 创建充值流水
     *
     * @param member 会员
     * @param amount 充值金额
     * @return 充值流水
     */
    Trade create(Member member, BigDecimal amount, Trade.Style style);

    /**
     * 创建充值流水
     *
     * @param member 会员
     * @param amount 充值金额
     * @return 充值流水
     */
    Trade createTrade(Member member, BigDecimal amount, Trade.Style style, BigDecimal prePoint);

    /**
     * 完成充值
     *
     * @param trade 流水
     */
    void completeTrade(Trade trade);

    /**
     * 查找当前会员的交易流水记录
     *
     * @param pageable
     * @param member
     * @param style
     * @return
     */
    Page findPage(Pageable pageable, Member member, Trade.Style style);

    /**
     * 查找当前用户交易成功的流水记录
     *
     * @param pageable
     * @param member
     * @return
     */
    Page findPageSuccess(Pageable pageable, Member member);


    /**
     * 查找交易成功的流水记录
     *
     * @param pageable
     * @return
     */
    Page findPageSuccess(Pageable pageable);

    /**
     * 创建充值记录
     *
     * @param member
     * @param amount
     * @return
     */
    Trade createRechargeTrade(Member member, BigDecimal amount);


}